//
//  UITextField+Done.m
//
//  Created by apple on 2019/5/23.
//  Copyright © 2019 ds. All rights reserved.
//

#import "UITextField+Done.h"

@implementation UITextField (Done)

- (void)addDoenButton{
    UIView *topView1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreen_W, 40)];
    topView1.backgroundColor = COLOR(248, 248, 248);
    UIButton *disMissBtn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    disMissBtn1.frame = CGRectMake(KScreen_W-120, 0, 100, 40);
    [disMissBtn1 setTitle:@"完成" forState:UIControlStateNormal];
    [disMissBtn1 setTitleColor:ColorHex(@"#999999") forState:UIControlStateNormal];
    [disMissBtn1.titleLabel setFont:Font(13)];
    disMissBtn1.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    [disMissBtn1 addTarget:self action:@selector(dismissKeyBoard) forControlEvents:UIControlEventTouchUpInside];
    [topView1 addSubview:disMissBtn1];
    [self setInputAccessoryView:topView1];
}
- (void)dismissKeyBoard{
    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
}

@end
